package com.demo.service;

import com.demo.annotation.DataSourceRouter;
import com.demo.component.datasource.DataSourceType;
import com.demo.entity.User;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by hardy
 * 2018/6/8 下午4:41
 */
public interface UserService {


    // 主库测试
    User getUserM(long id);

    // 从库测试 增加注解
    @DataSourceRouter(DataSourceType.SLAVE)
    User getUserS(long id);

    // 1.测试事务 2.测试mapper provider
    @Transactional
    long saveUser(String name, int age);

    // 事务测试
    @Transactional
    void updateUser(long id, String name, int age);
}
